<?php
 header("content-type:text/html;charset=utf-8");
include("Template.php") ;

  
$table=  @$_POST["table"];
$trueTableName=ReplaceTableName( $table,$DbPrefix);

echo TableList($db) ;   

function TableList($tablename)
{
   $tbllist="<form method=\"post\"><select id=\"table\" name=\"table\">";
   $rs= mysql_list_tables($tablename);
   
   while($row=mysql_fetch_row($rs))
   {
       
      $tbllist.="<option value=\"{$row[0]}\">{$row[0]}</option>\r";   
   }
   
   return $tbllist."</select><input type=\"submit\" value=\"生成\"></form>";
}






if($table){
echo "<textarea cols=\"120\" rows=\"80\">".TemplateReplace('Form',$trueTableName,$ActionTemplate)."</textarea>";

 WriteFile($ActionPath.$trueTableName."Action.class.php",TemplateReplace('Form',$trueTableName,$ActionTemplate));
 
if(!  file_exists($ActionPath."CommonAction.class.php"))
{
    WriteFile($ActionPath."CommonAction.class.php",$CommonActionTemplate);
}

}


?>
